import axios from '@/libs/axios.js'
import baseUrl from './index'
let jsonHeaders = {'content-type': 'application/json;charset=UTF-8'}

// 查询工具列表
export const getToolList = params => {
    return axios({
        url: `${baseUrl}/resource-manager/tools`,
        method: 'get',
        params,
        headers: jsonHeaders,
    })
}

// 查询工具详情
export const getToolDetail = id => {
    return axios({
        url: `${baseUrl}/resource-manager/tools/${id}`,
        method: 'get',
        headers: jsonHeaders,
    })
}

// 创建工具
export const addTools = data => {
    return axios({
        url: `${baseUrl}/resource-manager/tools`,
        method: 'post',
        data,
        headers: jsonHeaders,
    })
}

// 修改工具
export const updateTool = data => {
    return axios({
        url: `${baseUrl}/resource-manager/tools`,
        method: 'put',
        data,
        headers: jsonHeaders,
    })
}

// 删除工具，支持批量操作
export const deleteTools = idList => {
    return axios({
        url: `${baseUrl}/resource-manager/tools`,
        method: 'delete',
        params: {
            idList
        },
        headers: jsonHeaders,
    })
}